package com.myk.game.gobangchess.ai.shock;

public class P4_Engine {

    public static int[] p4_engine(int[][] board, int playerTurn, int difficulty) {
        int[] pointSet;

        int isKill, killDeep;
        int[] killPoint = {0,0};

        if (difficulty == 2) {
            int[] killJudgingDeep5Result = Kill_judging_deep5.kill_judging_deep5(board, playerTurn);
            isKill = killJudgingDeep5Result[0];
            killPoint[0] = killJudgingDeep5Result[1];
            killPoint[1] = killJudgingDeep5Result[2];
            killDeep = killJudgingDeep5Result[3];
        } else if (difficulty == 1) {
            int[] killJudgingDeep3Result = Kill_judging_deep3.kill_judging_deep3(board, playerTurn);
            isKill = killJudgingDeep3Result[0];
            killPoint[0] = killJudgingDeep3Result[1];
            killPoint[1] = killJudgingDeep3Result[2];
            killDeep = killJudgingDeep3Result[3];
        } else {
            throw new IllegalArgumentException("Invalid difficulty level");
        }

        if (isKill == 1) {
            if (killDeep == 1) {
                pointSet = Findwinpoint.findwinpoint(board, playerTurn);
                pointSet[0] = pointSet[0] + 1;
                pointSet[1] = pointSet[1] + 1;

            } else {
                pointSet = killPoint;
            }
        } else {
            int[] point;
            if (difficulty == 2) {
                point = Score_prediction_deep2_alt_ford.score_prediction_deep2_alt_ford(board, playerTurn)[0];
            } else if (difficulty == 1) {
                point = Score_prediction_deep1_ford.score_prediction_deep1_ford(board, playerTurn)[0];
            } else {
                throw new IllegalArgumentException("Invalid difficulty level");
            }
            pointSet = point;
        }

        return new int[]{pointSet[1], pointSet[0]};
    }
}
